﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using TomShane.Neoforce.Controls;

namespace XGameLibrary.Controls
{
    public abstract class Control
    {
        #region Field Region
        protected bool hasFocus;
        protected Manager manager;
        #endregion

        #region Event Region

        public event System.EventHandler Selected;

        #endregion

        #region Property Region

        public string Name;
        public string Text;
        public Vector2 Size;

        public Vector2 Position;

        public object Value;
        public virtual bool HasFocus
        {
            get { return hasFocus; }
            set { hasFocus = value; }
        }
        public bool Enabled;
        public bool Visible;
        public bool TabStop;

        public SpriteFont SpriteFont;

        public Color Color;

        public string Type;

        #endregion

        #region Constructor Region

        public Control(Manager manager)
        {
            this.manager = manager;
            Color = Color.White;
            Enabled = true;
            Visible = true;
            SpriteFont = ControlManager.SpriteFont;
        }

        #endregion

        #region Abstract Methods

        public abstract void Update(GameTime gameTime);
        public abstract void Draw(SpriteBatch spriteBatch);
        public abstract void HandleInput();
        public abstract void HandleMouse();

        #endregion

        #region Virtual Methods

        protected virtual void OnSelected(System.EventArgs e)
        {
            if (Selected != null)
            {
                Selected(this, e);
            }
        }

        #endregion
    }
}
